package com.example.dao;

import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.example.entity.JB2HSSE;
import com.example.entity.JB3QCD;
import com.example.entity.JOBCard;
import com.example.entity.JobcardWeIdListMA;
import com.example.entity.JobcardWeIdListPI;
import com.example.entity.JobcardWeIdListST;
import com.example.entity.PreWorkPackage;
import com.example.entity.PreWorkPackageDrawings;
import com.example.entity.ProjectShell;

@Mapper
public interface UxJbcardMapper {

	/**
	 * 查询最大ID
	 * 
	 * @return
	 */

	public Integer select_uxdram_MaxID();

	public Integer select_UXMMTMaxID();

	public Integer select_uxjobpw_MaxID();

	public Integer select_uxjobpw_lieitem_MaxID();

	/**
	 * 查出项目下某专业第一序列
	 * 
	 * @return
	 */
	public List<Integer> selectUXMPP_MaterPri(@Param("projectId") Integer projectId,
			@Param("discipline") String discipline);



	/**
	 * 查出项目下某专业第一序列
	 *
	 * @return
	 */
	public List<Integer> selectJobcardPriority_MaterPri(@Param("projectId") Integer projectId,
														@Param("bpId") String bpId);
	/**
	 * 查询加设图是否已经创建安装JobcArd
	 * 
	 * @param JbcardNo
	 * @param Rev
	 * @return
	 */
	public int selectJbcard(@Param("jbcardNo") String JbcardNo, @Param("Rev") String Rev);

	/**
	 * 查出所有缺料Jobacrd
	 * 
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_NOK();

	/**
	 * 查出所有未下发的 jobcard 相关备料情况
	 * 
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationST();

	/**
	 * 根据备料优先级查询所有的构件
	 * 
	 * @param projectId
	 * @param materPri
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationST_fabrication(
			@Param("projectId") Integer projectId, @Param("materPri") Integer materPri);


	/**
	 * 根据备料优先级查询所有的构件
	 * 舾装专业
	 * @param projectId
	 * @param materPri
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationAR_fabrication(
			@Param("projectId") Integer projectId, @Param("materPri") Integer materPri);

	/**
	 * 查询构件相关零件库存信息
	 * @param projectId
	 * @param drawingNo
	 * @param Rev
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationST_Fabrication_Part( @Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	
	public List<Map<String, String>> selectjobcard_MaterialPreparationST_Nesting_bulk( @Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	public List<Map<String, String>> selectjobcard_MaterialPreparationAR_Nesting_bulk( @Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);


	public List<Map<String, String>> selectjobcard_MaterialPreparationST_Nesting_remnant( @Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	public List<Map<String, String>> selectjobcard_MaterialPreparationAR_Nesting_remnant( @Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	
	
	/**
	 * 查询下切Jobcard信息根据零件编码
	 * @param projectId
	 * @param drawingNo
	 * @param Rev
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_NestingST_PartNo( @Param("projectId") Integer projectId, @Param("list") List<String> partNo);

	
 
	public List<Map<String, String>> selectjobcard_MaterialPreparationPI();

	
	
	/**
	 * 查询出管线专业某序列中的Iso图备料单
	 * 
	 * @param projectId
	 * @param materPri
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationPI_Shop(@Param("projectId") Integer projectId,
			@Param("materPri") Integer materPri);

    /**
     * 查询出舾装专业某序列中的Iso图备料单
     *
     * @param projectId
     * @param materPri
     * @return
     */
    public List<Map<String, String>> selectjobcard_MaterialPreparationAR_Shop(@Param("projectId") Integer projectId,
                                                                              @Param("materPri") Integer materPri);

	/**
	 * 查出iso图所需构件信息
	 * 
	 * @param projectId
	 * @param drawingNo
	 * @param Rev
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationPI_Shop_fabrication(
			@Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	/**
	 * 查出iso图所需母材信息
	 * 
	 * @param projectId
	 * @param drawingNo
	 * @param Rev
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationPI_Shop_bulk(
			@Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);


	/**
	 * 舾装专业根据图纸信息查询母材物料信息
	 * @param projectId
	 * @param drawingNo
	 * @param Rev
	 * @return
	 */
	public List<Map<String, String>> selectjobcard_MaterialPreparationAR_bulk(@Param("projectId") Integer projectId,
																			  @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);



    /**
     * 查出iso图所需母材信息  舾装专业
     *
     * @param projectId
     * @param drawingNo
     * @param Rev
     * @return
     */
    public List<Map<String, String>> selectjobcard_MaterialPreparationAR_Shop_bulk(
            @Param("projectId") Integer projectId, @Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	public List<Map<String, String>> selectjobcard_MaterialPreparationMA_bulk(@Param("projectId") Integer projectId,
			@Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	public List<Map<String, String>> selectjobcard_MaterialPreparationMA_Part(@Param("projectId") Integer projectId,
			@Param("drawingNo") String drawingNo, @Param("Rev") String Rev);

	public List<Map<String, String>> selectjobcard_MaterialPreparationMA_tag(@Param("projectId") Integer projectId,
			@Param("materPri") Integer materPri);

	/**
	 * 查询jobcard 的缺料情况
	 * 
	 * @return
	 */
	public List<Map<String, String>> select_Jbcard_Material_Part();

	public List<Map<String, String>> select_Jbcard_Material_CUT();

	 
	/**
	 * 查询物料相关MTO信息
	 * 
	 * @param set
	 * @return
	 */
	public List<Map<String, String>> select_Jbcard_Material_MTO(@Param("Set") Set<String> set);

	/**
	 * 插入相关缺料信息
	 * 
	 * @param list
	 * @return
	 */
	public int INSERT_uxdram(@Param("list") List<Map<String, String>> list, @Param("Id") Integer Id);

	public int INSERT_uxdram_PERM(@Param("list") List<Map<String, String>> list, @Param("Id") Integer Id);

	/**
	 * 删除 jobacrd 物料缺失信息
	 * 
	 * @return
	 */
	public int delete_uxdram();

	public int delete_uxdram_PERM();

	/**
	 * 插入相关焊口号信息
	 * 
	 * @param list
	 * @return
	 */

	public List<JobcardWeIdListST> selectWeIdListST(@Param("DrawingNo") String DrawingNo,
			@Param("DrawingVersion") String DrawingVersion, @Param("projectId") Integer projectId);

	public List<JobcardWeIdListMA> selectWeIdListMA(@Param("DrawingNo") String DrawingNo,
			@Param("DrawingVersion") String DrawingVersion, @Param("projectId") Integer projectId);

	public List<JobcardWeIdListPI> selectWeIdListPI(@Param("DrawingNo") String DrawingNo,
			@Param("DrawingVersion") String DrawingVersion, @Param("projectId") Integer projectId);

	/**
	 * 舾装专业生成JobCard
	 * @param DrawingNo
	 * @param DrawingVersion
	 * @param projectId
	 * @return
	 */
	public List<JobcardWeIdListPI> selectWeIdListAR(@Param("DrawingNo") String DrawingNo,
													@Param("DrawingVersion") String DrawingVersion, @Param("projectId") Integer projectId);
	public List<JobcardWeIdListPI> selectWeIdListPI_shop(@Param("DrawingNo") String DrawingNo,
			@Param("DrawingVersion") String DrawingVersion, @Param("projectId") Integer projectId);

	public List<JobcardWeIdListPI> selectWeIdListAR_shop(@Param("DrawingNo") String DrawingNo,
														 @Param("DrawingVersion") String DrawingVersion, @Param("projectId") Integer projectId);

	public List<Map<String, String>> select_PressurePackage_ISO_STATUS(@Param("projectId") Integer projectId,
			@Param("list") Set<Map<String, String>> isos);

	/**
	 * 根据预工作包与零件编码查询相关JObcard 信息
	 * 
	 * @param partNo
	 * @param WorkPackageNo
	 * @return
	 */
	public Map<String, Object> selectJOBCard_partNo_WorkPackageNo(@Param("partNo") String partNo,
			@Param("WorkPackageNo") String WorkPackageNo);

	/**
	 * 查询预工作包相关数据
	 * 
	 * @return
	 */
	public List<PreWorkPackage> select_PreWorkPackage_status(@Param("status") String status);

	public List<PreWorkPackage> select_PreWorkPackage_status_StatusV2(@Param("status") String status,
			@Param("statusV2") String statusV2);

	public List<Map<String, Object>> select_PreWorkPackage_Lineitem(@Param("recordId") Integer recordId);

	public JOBCard getP6ScheduleL5Activity(JOBCard jobcard);

	public List<JB2HSSE> listJBHSSEDocuments(@Param("project_id") Integer project_id,
			@Param("working_Procedure") String working_Procedure);

	public List<JB3QCD> listJBQCDDocuments(@Param("project_id") Integer project_id,
			@Param("working_Procedure") String working_Procedure);

	/**
	 * 修改Jobcard 预工作包号
	 * 
	 * @param
	 * @param list
	 * @return
	 */
	public int UPDATE_UXJBCARD_PREWorkPackageNo(@Param("PREWorkPackageNo") String PREWorkPackageNo,
			@Param("projectId") Integer projectId, @Param("list") List<PreWorkPackageDrawings> list);

	/**
	 * 修改工作包触发状态
	 * 
	 * @param record_no
	 * @return
	 */
	public int updateWorkPackageTriggerStatusV2(@Param("record_no") String record_no, @Param("status") String status);

	public String select_WorkPackageTriggerStatusV2(@Param("recordNo") String recordNo);

	/**
	 * 插入预工作包行项
	 * 
	 * @param list
	 * @param Id
	 * @param tabId
	 * @return
	 */
	public int insert_uxjobpw_lieitem(@Param("list") List<Map<String, String>> list,
			@Param("recordNo") Integer recordNo, @Param("id") Integer id, @Param("tabId") Integer tabId);

	public int update_UXJBCARD_MATERIAL_STATUS(@Param("list") List<String> list);// 修改Jobcard 备料信息

	public int update_UXJBCARD_MATERIAL_STATUS2(@Param("recordNo") String recordNo);// 修改Jobcard 备料信息

	public int update_UXJBCARD_MATERIAL_STATUS_ListMap(@Param("list") List<Map<String, String>> list);// 修改Jobcard 备料信息

	public List<String> slect_Jbcard_recordNo(@Param("PREWorkPackageNo") String PREWorkPackageNo,
			@Param("projectId") Integer projectId);

	public List<Map<String, String>> select_Jbcard_Material_Part_PI(); // 查询构件所需 的物料但即时库存 没有的

	public List<Map<String, String>> select_Jbcard_Material_Part_AR(); // 查询构件所需 的物料但即时库存 没有的

	public List<Map<String, String>> select_Jbcard_Material_Bulk_PI(); // 查询构件所需 的物料但即时库存 没有的

	public List<Map<String, String>> select_Jbcard_Material_Bulk_AR(); // 查询构件所需 的物料但即时库存 没有的

	public List<Map<String, String>> select_Jbcard_Material_MATERIAL_PI(); // 查询构件所需 的母材但即时库存 没有的

	public List<Map<String, String>> select_Jbcard_Material_MATERIAL_AR(); // 查询构件所需 的母材但即时库存 没有的

	public List<Map<String, String>> select_Jbcard_Material_Fabrication_PI(); // 查询构件所需 的但即时库存 没有的

	public List<PreWorkPackageDrawings> select_WeIdListPI_Dia_Inch(@Param("projectId") Integer projectId,
			@Param("moduleName") String moduleName, @Param("grade") String grade); // 查询spool 的寸口信息

	public List<PreWorkPackageDrawings> select_WeIdListAR_Dia_Inch(@Param("projectId") Integer projectId,
																   @Param("moduleName") String moduleName, @Param("grade") String grade); // 查询spool 的寸口信息

	public List<String> select_WeIdListPI_Dia_Inch_Grade(@Param("projectId") Integer projectId,
			@Param("moduleName") String moduleName); // 查询SPOOL 相关的材质类型

	public List<String> select_WeIdListAR_Dia_Inch_Grade(@Param("projectId") Integer projectId,
														 @Param("moduleName") String moduleName); // 查询SPOOL 相关的材质类型

}
